<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=9" />
		<meta http-equiv="pragma" content="no-cache" />
		<title>系统日记</title>
		<%@ include file="../../common/Admin-list.jsp"%>  
		<link rel="stylesheet" type="text/css" href="<%=basePath %>easyui/themes/gray/easyui.css"/>  
		<link rel="stylesheet" type="text/css" href="<%=basePath %>easyui/themes/icon.css"/>   
		<script type="text/javascript" src="<%=basePath %>JS/jquery/jquery-1.7.1.min.js"></script>     
		<script type="text/javascript" src="<%=basePath %>easyui/jquery.easyui.min.js"></script>
	
 		<script type="text/javascript">
			$(function(){
				$('#dataGridSys').datagrid({		
					height:'505',
					width:'100%',
					rownumbers:true,//设置为true将显示行数					
					striped:true, //设置为true将交替显示行背景
					fitColumns:true,//设置为true将自动使列适应表格宽度以防止出现水平滚动
					animate:true,
					collapsible:true,
					idField:'pk_User',//id字段
					pagination : true,//分页控件
					pageSize : 10,
				    pageList : [10, 20, 30],
				    url : '../siteLog/listData.json',
					loadMsg : '数据装载中......',
					singleSelect : true,//设置为 true，则只允许选中一行	
					toolbar: [ {
		                text : '刷新',
		                iconCls : 'icon-reload',
		                handler : function() {
		                	$('#dataGridSys').datagrid('reload');
		                }
					}],	
					columns:[[					          	
								{field:'id',hidden:true,editor:{type:'text'}},
								{field:'ipaddress',title:'标题',width:100,align:'center',editor:{type:'text'}},
								{field:'url',title:'描述',width:100,align:'center',editor:{type:'text'}},
								{field:'broswer',title:'链接路径',width:100,align:'center',editor:{type:'text'}},
								{field:'op_function_desc',title:'图片路径',width:100,align:'center',editor:{type:'text'}},								
								{field:'op_class_desc',title:'排序号',width:100,align:'center',editor:{type:'text'}},
												
								{field:'opt',title:'操作',width:50,align:'left',  
				                    formatter:function(value,rec,index){
				                   		var dele='<a title="删除" onclick="del(\''+ rec.id +'\')"  href="#">'+
				                        		'<img src="<%=basePath %>pages/Admin/Images/Icon/delete.gif" alt="Delete"></a>&nbsp;&nbsp;';				                        
				                                                 
				                        return edit+dele;  
				                    }  
				                 }								
					        ]]	
				});	
			})
			
			function edit(index){  //编辑   
				art.dialog.open('../siteLink/updateInterface.htm?type=edit&id='+index,{
					title: '',
					lock:true,
				  	width: '90%',
				    height: '90%'												   												   
				});
          	}
			
			function del(index){  //删除操作
				art.dialog({
					icon: 'question',	
					width:250,
				    content: '你确定删除该数据？',
				    ok: function () {				    	
				    	$.ajax({
							type:'POST',
							dataType:'json',
							async:false,
							url:'../siteLink/delete.json',
							data:{id:index,delSub:true},
							success:function(data){
								if(data.success=true){									
									art.dialog.alert('删除成功！');
									window.location.reload();  
								}else{
									art.dialog.alert('删除失败，请联系管理员！');
								}
							}
						});
				    },
				    cancelVal: '取消',
				    cancel: true 
				});				
          	}
		
			
		</script>	
	</head>
	<body>
		<div>			
			<div id="tab">
        		<ul>
            		<li class="Current">
            			<a href="#"><span>友情链接</span></a>
            		</li>
            	</ul>
    		</div>

			<table id="dataGridSys"  style="width: 100%;"></table>
		</div>
	</body>
</html>